package com.huawei.Galenus.service.impl;

import com.huawei.Galenus.dao.ProposalRepository;
import com.huawei.Galenus.domain.Proposal;
import com.huawei.Galenus.service.ProposalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ProposalService")
public class ProposalServiceImpl implements ProposalService {

    @Autowired
    private ProposalRepository proposalRepository;

    @Override
    public Integer launch(Proposal proposal) {
        return proposalRepository.save(proposal);
    }

    @Override
    public List<Proposal> getAll(String ssaId) {
        return proposalRepository.selectAll(ssaId);
    }

    @Override
    public Integer vote(Integer pid, Double amount) {
        return proposalRepository.updateAmount(pid, amount);
    }
}
